package haltica.com.mx.ape.util;

import java.util.Formatter;

public class UtilNumber {
	
	/**
	 * 
	 * @param cadena
	 * @return
	 */
	public static final Integer getNumber(String cadena) {
		try {
			return new Integer(cadena);
		} catch (NumberFormatException nfe) {
			return null;
		}
	}
	
	/**
	 * 
	 * @param number
	 * @param cantCeros
	 * @return
	 */
	public static final String addCerosIzq(int number, int cantCeros) {
		
		Formatter fmt = new Formatter();
		fmt.format("%0" + cantCeros + "d", number);
		return fmt.toString();
	}
	
	
	
	public static void main(String[] args) {
		for (int i = 0; i < 5; i++) {
			System.out.println(addCerosIzq(i+10000, 5));
		}
	}
}
